const path = require('path');// 引入path模块
const debug = process.env.NODE_ENV !== 'production'
const { config } = require('process');
function resolve(dir) {
    return path.join(__dirname,dir)// 设置绝对路径
}

module.exports={
    // 路径别名
    chainWebpack:(config)=>{
        config.resolve.alias
        .set('@',resolve('./src'))
        .set('assets',resolve('src/assets'))
        .set('utils',resolve('src/utils'))
        .set('components',resolve('src/components'))
    },
    devServer: {
		port: 8081, //端口号
        proxy: { // 配置跨域
            '/api': {
                target: 'http://localhost:8080/',
                ws: true,// 代理websocket
                changeOrigin: true, //是否跨域
                pathRewrite: {
                '^/api': '/'
                }
            },
        },
        before: app => { }
    }
}